<div id='checkoutFormDIV'>
    <div class="category_title">
        <h2>
            <a href="/">Cart</a> 
            &raquo; <label class="normal">Your Deals</label> 
        </h2>
    </div>
    <br />
<?=form_open($this->public_model->getBaseSSLUrl() . 'shoppingcart/checkout','name="checkoutForm"');?>
<table class="shopping_cart">
	<thead>  				
		<td width="60px" style="display:none;">Remove</td> 
		<td width="80px" ></td> 
        <td width="260px" style="text-align: left;" >Deal</td>
		<td width="60px">Payment Price</td> 
		<td width="120px" >Quantity</td>  
		<td  width="120px" >Total</td>
        <td  width="120px">Action</td>  
	</thead>
    <tbody>
	<?php 
	$total_prices = 0;
	$index = 0;
	foreach ($this->cart->contents() as $item):?>	
	<tr class="<?=($index%2==0)?'':'odd'?>">  
       <td style="display:none;"><input type="checkbox" value="<?=$items['rowid']?>"  />  
       		DELETE HIDDEN  
       </td>
        <td>
       		<a href="/deal/detail/<?=$item['id']?>"><img src="/<?=$item['image_path']?>" width="75px" height="75px"/></a>
       </td>  
       <td style="text-align: left;" >
       		<a href="/deal/detail/<?=$item['id']?>"><?=$item['name']?></a>
       </td>
      
       <td>
       		$<?=$item['price'];?>
       	</td>  
       <td>
            <?=$item['qty']?>
       </td>       
  	   <td>
  	  		$<?=$item['price'] * $item['qty']?>
  	   	</td>
        <td>
            <a onclick="javascript:deleteCartItem('<?=$item['rowid']?>');" ><img style="vertical-align: text-top;" src="<?=TEMPLATE_IMAGE_PATH?>/icon_cart/cart_delete.png" width="16px"/>&nbsp; Delete</a>
        </td>
  	 </tr>
  	 <?
  	 $total_prices += $item['price'] * $item['qty'];
  	 $index++;
  	 endforeach;
  	 ?>
     <?php if(count($this->cart->contents()) == 0):?>
    	<tr>   
	   		<td colspan="6">Your cart is empty. </td >
	 	 </tr>	
    <?php endif;?>
     </tbody>
     
  	 <?php if(count($this->cart->contents()) > 0):?>
     <tfoot >
     <tr>
    	<td class="total" colspan="6">
    		<b>Total:</b> $<?=$total_prices?>  
    	</td>
    </tr>
  	 <tr>   
   		<td colspan="6" style="text-align: right;display: none;">
            <a onclick="javascript:clearcart();" >&nbsp;Clear All&nbsp;</a>
       	</td >
 	 </tr>  
     
     </tfoot>	 
  	 <?endif?>
</table>


<?php if(count($this->cart->contents()) > 0):?>
    <br />
    <?php echo validation_errors('<div class="errorText">', '</div>'); ?>
    <div id="errorDiv" class="errorText"></div>
    <br />
    <?php $this->load->view('render/payment'); ?>
<?endif?>

<?=form_close();?>
<script>
<!-- 
	 var options = {   
            success: doCheckoutResponse  // post-submit callback 
    }; 
     
    // bind to the form's submit event 
    $('[name=checkoutForm]').submit(function() { 
        $(this).ajaxSubmit(options);      
        return false; 
    });
-->    
</script>
</div>